import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:keframe/keframe.dart';

class ItemsDataWidgets extends StatelessWidget {
  var img_url;
  var title;
  var all_videos;
  var sub_title;
  var subscribe;
  ItemsDataWidgets(
      {Key? key,
      this.img_url,
      this.title,
      this.all_videos,
      this.sub_title,
      this.subscribe})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 328.w,
      margin: EdgeInsets.only(bottom: 14.h),
      child: Row(
        children: [
          ClipRRect(
            borderRadius: BorderRadius.circular(4.w),
            child: FrameSeparateWidget(
                child: CachedNetworkImage(
              imageUrl: '${img_url}',
              width: 62.w,
              height: 87.h,
              fit: BoxFit.fill,
              useOldImageOnUrlChange: true,
              memCacheHeight: 400,
              memCacheWidth: 400,
              maxHeightDiskCache: 400,
              maxWidthDiskCache: 400,
              placeholder: (BuildContext context, value) {
                return Center(
                  child: Text(
                    '加载中~',
                    style: TextStyle(color: Color(0xff999999), fontSize: 12.sp),
                  ),
                );
              },
            )),
          ),
          Container(
            width: 11.w,
          ),
          Expanded(
              child: Container(
            height: 87.h,
            alignment: Alignment.topLeft,
            child: Column(
              children: [
                Text(
                  '${title}',
                  style:
                      TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w500),
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                ),
                Container(
                  child: Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text(
                        '共${all_videos}集',
                        style: TextStyle(
                            color: Color(0xff999999), fontSize: 12.sp),
                      ),
                      Container(
                        width: 13.w,
                      ),
                      subscribe == ''
                          ? Container(
                              width: 6.w,
                            )
                          : Image.asset(
                              'images/lists_bofang.png',
                              width: 6.w,
                              height: 8.h,
                            ),
                      Container(
                        width: 4.w,
                      ),
                      Container(
                        padding: EdgeInsets.only(bottom: 3.h),
                        child: Text(
                          '${subscribe}',
                          style: TextStyle(
                              color: Color(0xff999999), fontSize: 12.sp),
                        ),
                      )
                    ],
                  ),
                ),
                Container(
                  child: Text(
                    '${sub_title}',
                    style: TextStyle(color: Color(0xff999999), fontSize: 12.sp),
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                  ),
                )
              ],
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
            ),
          ))
        ],
      ),
    );
  }
}
